package com.nb.cloud.doc.auth;

/**
 * @author lihaoyang6
 * @date 2024年07月14日 14:10
 */
public class UserContextHolder {

    private static final ThreadLocal<LoginUser> contextHolder = new ThreadLocal<>();

    public static void setUser(LoginUser user) {
        contextHolder.set(user);
    }

    public static LoginUser getUser() {
        return contextHolder.get();
    }

    public static void clear() {
        contextHolder.remove();
    }
}
